﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections.Specialized;
using System.Web.UI.WebControls;
using System.Xml.Linq;
using Anthony.Library;
using System.Net.Mail;
using System.Text;
using Formsy.Data.Services;
using Formsy.Data.Interfaces;
using Formsy.Common;

namespace Formsy.Providers.DataStore
{
    public class StandardProvider : DataStoreProvider
    {
        public override void Initialize(string name, NameValueCollection config)
        {
            base.Initialize(name, config);
        }


        /// <summary>
        /// Inserts entry.
        /// </summary>
        /// <returns></returns>
        public override IFormsyEntry InsertEntry(string formName, bool isUpdate)
        {
            if (isUpdate)
                return null;

            return HttpDataService.Instance.FormsyService.InsertEntry(formName);
        }

        /// <summary>
        /// Inserts entry.
        /// </summary>
        /// <returns></returns>
        public override List<IFormsyEntryData> InsertEntryData(int formId, int entryId, Dictionary<string, string> dictionary, bool isUpdate)
        {
            List<IFormsyEntryData> data;
            if (isUpdate)
                data = HttpDataService.Instance.FormsyService.UpdateEntryData(formId, entryId, dictionary);
            else
                data = HttpDataService.Instance.FormsyService.InsertEntryData(formId, entryId, dictionary);

            return data;
        }

    }
}
